package com.shc.community.utils;

public class RedisKeyUtil {

    private static final String SPLIT = ":";
    private static final String PREFIX_ENTITY_LIKE = "like:entity";
    private static final String PREFIX_USER_LIKE = "like:user";
    private static final String PREFIX_FOLLOWEE = "followee";
    private static final String PREFIX_FOLLOWER = "follower";
    private static final String PREFIX__KAPTCHA = "kaptcha";
    private static final String PREFIX__TICKET = "ticket";
    private static final String PREFIX__USER = "user";
    //某个实体的赞
    public static String getEntityLikeKey(int entityType,int entityId){
        return PREFIX_ENTITY_LIKE + SPLIT + entityType + SPLIT + entityId;
    }
    //某个用户的赞
    public static String getUserLikeKey(int userId){
        return PREFIX_USER_LIKE + SPLIT + userId;
    }
    //某个用户关注的实体
    public static String getFolloweeKey(int userId, int entityType){
        return PREFIX_FOLLOWEE + SPLIT + userId + SPLIT + entityType;
    }
    //某个用户拥有的粉丝
    public static String getFollowerKey(int entityType,int entityId){
        return PREFIX_FOLLOWER + SPLIT + entityType + SPLIT + entityId;
    }
    //验证码
    public static String getKaptcha(String owner){
        return PREFIX__KAPTCHA +SPLIT + owner;
    }
    //登录凭证
    public static String getTicketKey(String ticket){
        return PREFIX__TICKET +SPLIT + ticket;
    }
    //用户
    public static String getUserKey(int userId){
        return PREFIX__USER + SPLIT + userId;
    }
}
